<template>
  <userCorrelation
    v-if="isshow"
    :authorization-list="authorizationList"
    :btn-fix="false"
    :get-authorization-method="getAuthorizationMethod"
    option-method="roleServiceImpl.queryTable"
    page-name="UserRole"
    :page-setting="pageSetting"
    :table-top-list="tableTopList"
    :tables="tables"
    :tables-column="tablesColumn"
  />
</template>

<script>
  import { Mixin } from '@/common/minxin/Mixin'
  import { GFCD } from '@/utils/utils'
  import userCorrelation from '../../components/userCorrelation.vue'
  import UserRole from '../../components/json/UserRole'
  import { translateTitle } from '@/utils/i18n'
  export default {
    name: 'UserRole',
    components: { userCorrelation },
    mixins: [Mixin],
    data() {
      return {
        isshow: false,
        getAuthorizationMethod: {},
        tables: {
          tableList: [],
          count: 0,
          pageSize: 50,
          limit: 1,
          name: 'userAuthorization',
          operation: true,
          isNew: true,
          myselfOperation: true, //自己单独的双击事件
          autoQuery: true, //第一次自动查询
          noDelModeify: true, //删除不弹框
        },
        authorizationList: [
          {
            childrenTab: {
              isChildren: true,
              tableList: [],
              count: 0,
              pageSize: 50,
              limit: 1,
              width: '100',
              name: 'UserRoleChildren',
              operation: true,
              isNew: false,
              noEdit: true,
              noclick: true, //不单击请求接口
            },
            label: translateTitle('Dams.DamsSystemManagement.授权的角色'),
            name: translateTitle('Dams.DamsSystemManagement.授权的角色'),
          },
        ],
        tablesColumn: [],
        pageSetting: {
          search: {
            form: {
              field: [],
            },
          },
        },
        tableTopList: [],
      }
    },
    created() {
      this.init()
    },
    methods: {
      init() {
        this.configSetting = GFCD('dams')
        let menuBtns = this.$store.getters['user/menuBtns']
        menuBtns.forEach((row) => {
          if (this.$route.name.indexOf(row.MENU_CODE) > -1 && row.SHOW_POSTION == 'tableTop') {
            this.tableTopList.push(row)
          }
        })
        this.url = `${this.configSetting.domain}${this.configSetting.baseUrl}`
        // this.nowJsonData().then((data) => {
        //   console.log(data)
        this.pageSetting = UserRole
        this.isshow = true
        let arr = this.pageSetting['UserRole'].children.dialog.form.field
        let newArr = []
        arr.forEach((v) => {
          if (v.type != 'button' && v.type != 'line' && !v.tableHidden) {
            newArr.push({
              label: v.label,
              porp: v.name,
            })
          }
        })
        this.authorizationList[0].mainTableColumn = newArr
        this.authorizationList[0].pageSetting = UserRole['UserRole']
        let arr1 = UserRole['UserRole'].dialog.form.field
        let newArr1 = []
        arr1.forEach((v) => {
          if (v.type != 'button' && v.type != 'line' && !v.tableHidden) {
            newArr1.push({
              label: v.label,
              porp: v.name,
            })
          }
        })
        this.tablesColumn = newArr1
        // })
      },
    },
  }
</script>

<style lang="scss" scoped></style>
